import React, { Component } from 'react';
import { Form, Icon, Input, Button, Checkbox, Row, Col } from 'antd';
import { Link } from 'react-router-dom';

const FormItem = Form.Item;


class NormalLoginForm extends Component {
  handleSubmit = (e) => {
    e.preventDefault();
    this.props.form.validateFields((err, values) => {
      if (!err) {
        console.log('Received values of form: ', values);
      }
    });
  }
  render() {
    const { getFieldDecorator } = this.props.form;
    return (
      <Form onSubmit={this.handleSubmit} className="login-form">
        <h2>使用手机注册</h2>
        <FormItem>
          {getFieldDecorator('userName', {
            rules: [{ required: true, message: 'Please input your username!' }],
          })(
            <Input addonBefore="+86" defaultValue="" />
          )}
        </FormItem>
        <Row gutter={16} style={{ marginBottom: 16 }}>
          <Col span={12}>
            <Input defaultValue="" placeholder="图形验证码" />
          </Col>
          <Col span={12}>
            <img src="img/yzm.jpeg" />
          </Col>
        </Row>
        <Row gutter={16} style={{ marginBottom: 16 }}>
          <Col span={12}>
            <Input defaultValue="" placeholder="短信验证码" />
          </Col>
          <Col span={12}>
            <Button type="primary" htmlType="submit" className="login-form-button"> 获取短信验证码 </Button>
          </Col>
        </Row>
        <FormItem>
          <Button type="primary" htmlType="submit" className="login-form-button"> 确定 </Button>
          {getFieldDecorator('remember', {
            valuePropName: 'checked',
            initialValue: true,
          })(
            <Checkbox>自动登录</Checkbox>
          )}
          <a className="login-form-forgot" href="">忘记密码</a>
        </FormItem>
      </Form>
    );
  }
}

const WrappedNormalLoginForm = Form.create()(NormalLoginForm);

export default WrappedNormalLoginForm;
